package com.heima.oopAdvanced.n01static.demo02;

import java.util.StringJoiner;

public class ArrayUtil {
    private ArrayUtil(){}

    public static String printArr(int[] nums) {
        StringJoiner sj = new StringJoiner(", ", "[", "]");
        for (int i = 0; i < nums.length; i++) {
            sj.add(nums[i]+"");
        }
        return sj.toString();
    }

    public static double getAerage(double[] nums){
        double ret = 0;
        for (int i = 0; i < nums.length; i++) {
            ret += nums[i];
        }
        return ret/nums.length;
    }
}
